package com.thermofisher.dsc.amanda.model.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.collections.CollectionUtils;

/**
 * @author wenjie.yang on 1/9/2019.
 */
@Setter
@Getter
public class ChartsBean {

  @JsonIgnore
  public final static String SERIES_CELL_HEADER = "xVar";

  private List<String> xAxis;

  private List<Map<String, Object>> series = new ArrayList<>();

  public Map<String, Object> initKeyMap() {
    Map<String, Object> map = new HashMap<>();
    if (CollectionUtils.isEmpty(xAxis)) {
      return map;
    }
    map.put(SERIES_CELL_HEADER, null);
    xAxis.forEach(x -> map.put(x, null));
    return map;
  }
}
